#import "SFUConstants.h"

// Width of the view
int const VIEW_WIDTH = 320;
// TabBar height
int const TAB_BAR_WIDTH = 44;
// Height of the view
int const VIEW_HEIGHT = 416;
// Height of Map View
int const MAP_VIEW_HEIGHT = 416;
// Left and right margin padding for content in the view
int const HORIZONTAL_PADDING = 10;
// Minimum zoom scale of content in the view
CGFloat const MIN_ZOOM_SCALE = 0.75;
// Maximum zoom scale of content in the view
CGFloat const MAX_ZOOM_SCALE = 3.0;
// Event table view cell height
int const EVENT_CELL_HEIGHT = 100;
// Building table view cell height
int const BUILDING_CELL_HEIGHT = 60;
// Point of interest table view cell height
int const POI_CELL_HEIGHT = 40;
// Maximum length of event heading shown in event cell
int const MAX_HEADING_LENGTH = 50;
// Maximum length of event description shown in event cell
int const MAX_DESCRIPTION_LENGTH = 100;
// default latitude
double const DEFAULT_LATITUDE = 49.277322f;
//default longitude
double const DEFAULT_LONGITUDE = -122.918696f;
//default span value(zoom)
double const DEFAULT_SPAN = 0.0225f;
//search span
double const SEARCH_SPAN = 0.005f;
// Unique subdirectory to store the event collection archive
NSString* const EVENT_SUBDIRECTORY = @"event_data";
// Unique archive key for keyed archiving of the collection
NSString* const SFUEVENT_ARCHIVE_KEY = @"SFUPersistentEventCollection";
// Maximum timeout interval for HTTP URL connections
double const CONN_TIMEOUT_INTERVAL = 60.0;
// Name of the file containing all bookmarked event data
NSString* const BOOKMARKED_EVENTS_FILENAME = @"bookmarks.dat";
// Number of maximum concurrent operations (threads)
int const MAX_CONCURRENT_OPERATION = 2;
// Height of message prompts
int const MSG_PROMPT_HEIGHT = 20;
// Height of text field input prompts
int const INPUT_PROMPT_HEIGHT = 244;
// Unique subdirectory to store the business directory archive
NSString* const BUSDIR_SUBDIRECTORY = @"directory_data";
// Name of the file containing all business directory data
NSString* const BUSDIRECTORY_FILENAME = @"bus_directory.dat";
// Business directory table view cell height
int const DIR_CELL_HEIGHT = 40;
// Unique subdirectory to store the points of interest archive
NSString* const POI_SUBDIRECTORY = @"poi_data";
// Name of the file containing all points of interest data
NSString* const POI_FILENAME = @"poi.dat";
// Unique subdirectory to store the application settings archive
NSString* const SETTINGS_SUBDIRECTORY = @"settings_data";
// Name of the file containing application settings data
NSString* const SETTINGS_FILENAME = @"settings.dat";
// Unique archive key for keyed archiving of the application settings
NSString* const SETTINGS_ARCHIVE_KEY = @"MapAppSettingsArchiveKey";
// The default map type (standard)
NSUInteger const DEFAULT_MAP_TYPE = 0;
// The default event caching interval
double const DEFAULT_EVENT_CACHE_INTERVAL = 1800;
// Unique subdirectory to store the building collection archive
NSString* const BUILDING_SUBDIRECTORY = @"building_data";
// Name of the file containing the building collection data
NSString* const BUILDING_FILENAME = @"buildingstore.dat";
// Default table view cell height
int const DEFAULT_CELL_HEIGHT = 50;
// Unique subdirectory to store the annotation collection archive
NSString* const ANNOTATION_SUBDIRECTORY = @"annotation_data";
// Name of the file containing the annotation collection data
NSString* const ANNOTATION_FILENAME = @"annotationstore.dat";
// Filename of the Foursquare login image
NSString* const FOURSQUARE_LOGIN_IMAGE = @"signinwith-foursquare.png";
// Filename of the Foursquare reference image
NSString* const FOURSQUARE_REF_IMAGE = @"light-poweredby-foursquare.png";
// Filename of the sign in button image
NSString* const SIGNIN_BUTTON_IMAGE_FILENAME = @"signin.png";
// Filename of the cancel button image
NSString* const CANCEL_BUTTON_IMAGE_FILENAME = @"cancel.png";
// The default limit to Foursquare venue searches
NSUInteger const DEFAULT_FOURSQUARE_VENUE_LIMIT = 25;
// The default limit to Foursquare tip searches
NSUInteger const DEFAULT_FOURSQUARE_TIP_LIMIT = 20;
// Filename of the Foursquare check-in image
NSString* const FOURSQUARE_CHECKIN_IMAGE = @"foursquare-checkin.png";
// Width of the Foursquare button
NSUInteger const FOURSQUARE_BUTTON_WIDTH = 200;//180;//280;
// Height of the Foursquare button
NSUInteger const FOURSQUARE_BUTTON_HEIGHT = 27;//24;//39;
// Filename of the generic building icon
NSString* const GENERIC_BUILDING_ICON = @"generic_building.jpg";
// Filename of the Foursquare venue does not exist image
NSString* const FOURSQUARE_NOVENUE_IMAGE = @"foursquare-novenue.png";
// Filename of the check in button image
NSString* const CHECKIN_BUTTON_IMAGE_FILENAME = @"checkin.png";
// Message informing of no currently active internet connection
NSString* const NO_CONNECTIVITY_MSG = @"No internet connection is available.";
// Default campus
NSUInteger const DEFAULT_CAMPUS = 0;
// Location of Surrey campus with respect to latitude
double const SURREY_LATITUDE = 49.187342;
// Location of Surrey campus with respect to longitude
double const SURREY_LONGITUDE = -122.850409;
// Location of Vancouver campus with respect to latitude 
double const VANCOUVER_LATITUDE = 49.284471;
// Location of Vancouver campus with respect to longitude
double const VANCOUVER_LONGITUDE = -123.113372;
// Span of Surrey campus on map
double const SURREY_SPAN = 0.005;
// Span of Vancouver campus on map 
double const VANCOUVER_SPAN = 0.00225;

/**
 * SFUConstants is an object containing all the constants
 * for the application.
 *
 * @author      James Lin
 * @author      Justin Hollander
 * @since       0.1.0
 */
@implementation SFUConstants

static NSString* const mapTypes[] = 
	{ @"0", @"Standard",
	  @"1", @"Satellite",
	  @"2", @"Hybrid" };

static NSString* const campuses[] = 
	{ @"0", @"Burnaby",
	  @"1", @"Surrey",
	  @"2", @"Vancouver"};

static NSString* const cacheIntervals[] = 
	{ @"300", @"5 minutes",
	  @"900", @"15 minutes",
	  @"1800", @"30 minutes",
	  @"2700", @"45 minutes",
	  @"3600", @"1 hour",
	  @"7200", @"2 hours" };

static NSString* const venueLimits[] = 
	{ @"5", @"5 venues",
	  @"10", @"10 venues",
	  @"15", @"15 venues",
	  @"20", @"20 venues",
	  @"25", @"25 venues",
	  @"30", @"30 venues",
      @"35", @"35 venues",
	  @"40", @"40 venues",
      @"45", @"45 venues",
	  @"50", @"50 venues" };

static NSString* const tipLimits[] = 
{ @"5", @"5 tips",
	@"10", @"10 tips",
	@"15", @"15 tips",
	@"20", @"20 tips",
	@"25", @"25 tips",
	@"30", @"30 tips",
	@"35", @"35 tips",
	@"40", @"40 tips",
	@"45", @"45 tips",
	@"50", @"50 tips" };

static NSString* const searchOptions[] = 
	{ @"Search for a Building",
      @"Search for Points of Interest",
	  @"Search for Events on Campus",
	  @"View SFU Business Directory" }; 

// All valid SFU events calendar URLs (size including commented out = 43*2)
static NSString* const calendarURLs[] = 
	{ @"SFU Events Calendar", @"http://events.sfu.ca/rss/calendar_id/2.xml", 
	  @"Academic Advising", @"http://events.sfu.ca/rss/calendar_id/29.xml", 
	  @"Academic Dates", @"http://events.sfu.ca/rss/calendar_id/4.xml", 
	  @"Biological Sciences", @"http://events.sfu.ca/rss/calendar_id/10.xml", 
	  @"Business Administration", @"http://events.sfu.ca/rss/calendar_id/24.xml", 
  	  @"Chemistry Department Events", @"http://events.sfu.ca/rss/calendar_id/8.xml", 
	  @"Continuing Studies", @"http://events.sfu.ca/rss/calendar_id/7.xml", 
	  @"Earth Sciences", @"http://events.sfu.ca/rss/calendar_id/20.xml", 
	  @"Environmental Health and Safety", @"http://events.sfu.ca/rss/calendar_id/12.xml", 
	  @"Faculty of Arts and Social Sciences", @"http://events.sfu.ca/rss/calendar_id/25.xml", 
	  @"Faculty of Health Sciences", @"http://events.sfu.ca/rss/calendar_id/21.xml", 
	  @"Graduate Studies Calendar", @"http://events.sfu.ca/rss/calendar_id/9.xml", 
	  @"Holidays and Closures", @"http://events.sfu.ca/rss/calendar_id/1.xml", 
	  @"International Development", @"http://events.sfu.ca/rss/calendar_id/23.xml", 
	  @"Teaching and Learning Centre", @"http://events.sfu.ca/rss/calendar_id/17.xml", 
	  @"Molecular Biology & Biochemistry", @"http://events.sfu.ca/rss/calendar_id/11.xml", 
	  @"Philosophy Department", @"http://events.sfu.ca/rss/calendar_id/27.xml", 
	  @"Research Studies", @"http://events.sfu.ca/rss/calendar_id/15.xml", 
	  @"School for International Studies", @"http://events.sfu.ca/rss/calendar_id/14.xml", 
	  @"School of Communication", @"http://events.sfu.ca/rss/calendar_id/16.xml", 
	  @"SFU ULife Calendar", @"http://events.sfu.ca/rss/calendar_id/3.xml", 
	  @"SFU Volunteer Services", @"http://events.sfu.ca/rss/calendar_id/18.xml", 
	  @"Student Services Deadlines", @"http://events.sfu.ca/rss/calendar_id/30.xml", 
	  @"Surrey Events Calendar", @"http://events.sfu.ca/rss/calendar_id/5.xml", 
	  @"Sustainability/Environmental Events", @"http://events.sfu.ca/rss/calendar_id/26.xml", 
	  @"Vancouver Events Calendar", @"http://events.sfu.ca/rss/calendar_id/6.xml", 
	  @"Advising", @"http://events.sfu.ca/rss/item_type_id/23.xml", 
	  @"Arts & Culture", @"http://events.sfu.ca/rss/item_type_id/6.xml", 
	  @"Ceremonies", @"http://events.sfu.ca/rss/item_type_id/7.xml", 
	  @"Dates & Deadlines", @"http://events.sfu.ca/rss/item_type_id/18.xml", 
	  @"Entertainment", @"http://events.sfu.ca/rss/item_type_id/1.xml", 
	  @"Fundraisers & Service", @"http://events.sfu.ca/rss/item_type_id/14.xml", 
	  @"Holiday", @"http://events.sfu.ca/rss/item_type_id/5.xml", 
	  @"Information Sessions", @"http://events.sfu.ca/rss/item_type_id/8.xml", 
	  @"Lectures & Talks", @"http://events.sfu.ca/rss/item_type_id/9.xml", 
	  @"Meetings", @"http://events.sfu.ca/rss/item_type_id/2.xml", 
	  @"Recreation", @"http://events.sfu.ca/rss/item_type_id/17.xml", 
	  @"Religion/Spiritual", @"http://events.sfu.ca/rss/item_type_id/16.xml", 
	  @"Research Studies", @"http://events.sfu.ca/rss/item_type_id/22.xml", 
	  @"Special Events", @"http://events.sfu.ca/rss/item_type_id/12.xml", 
	  @"Thesis Defences", @"http://events.sfu.ca/rss/item_type_id/10.xml", 
	  @"Varsity Athletics", @"http://events.sfu.ca/rss/item_type_id/11.xml", 
	  @"Workshops", @"http://events.sfu.ca/rss/item_type_id/15.xml" }; 

+ (NSDictionary*)getMapTypes {
	NSMutableDictionary* tempDict = [[[NSMutableDictionary alloc] init] autorelease];
	for (int i = 0; i < sizeof(mapTypes)/sizeof(NSString); i += 2) {
		NSNumber* key = [NSNumber numberWithInt:[mapTypes[i] intValue]];
		[tempDict setObject:mapTypes[i+1] forKey:key];
	}
	return tempDict;
}

+ (NSDictionary*)getCampuses {
	NSMutableDictionary* tempDict = [[[NSMutableDictionary alloc] init] autorelease];
	for (int i = 0; i < sizeof(campuses)/sizeof(NSString); i += 2) {
		NSNumber* key = [NSNumber numberWithInt:[campuses[i] intValue]];
		[tempDict setObject:campuses[i+1] forKey:key];
	}
	return tempDict;
}

+ (NSDictionary*)getCacheIntervals {
	NSMutableDictionary* tempDict = [[[NSMutableDictionary alloc] init] autorelease];
	for (int i = 0; i < sizeof(cacheIntervals)/sizeof(NSString); i += 2) {
		NSNumber* key = [NSNumber numberWithInt:[cacheIntervals[i] intValue]];
		[tempDict setObject:cacheIntervals[i+1] forKey:key];
	}
	return tempDict;
}

+ (NSDictionary*)getVenueLimits {
	NSMutableDictionary* tempDict = [[[NSMutableDictionary alloc] init] autorelease];
	for (int i = 0; i < sizeof(venueLimits)/sizeof(NSString); i += 2) {
		NSNumber* key = [NSNumber numberWithInt:[venueLimits[i] intValue]];
		[tempDict setObject:venueLimits[i+1] forKey:key];
	}
	return tempDict;
}

+ (NSDictionary*)getTipLimits {
	NSMutableDictionary* tempDict = [[[NSMutableDictionary alloc] init] autorelease];
	for (int i = 0; i < sizeof(tipLimits)/sizeof(NSString); i += 2) {
		NSNumber* key = [NSNumber numberWithInt:[tipLimits[i] intValue]];
		[tempDict setObject:tipLimits[i+1] forKey:key];
	}
	return tempDict;
}

+ (NSArray*)getSearchOptions {
	return [NSArray arrayWithObjects:searchOptions 
							   count:sizeof(searchOptions)/sizeof(NSString)];
}

+ (NSDictionary*)getCalendarURLs {
	NSMutableDictionary* tempDict = [[[NSMutableDictionary alloc] init] autorelease];
	for (int i = 0; i < sizeof(calendarURLs)/sizeof(NSString); i += 2) {
		[tempDict setValue:calendarURLs[i+1] forKey:calendarURLs[i]];
	}
	return tempDict;
}

+ (NSString*)POICategoryString:(PointOfInterestCategory)category {
	switch (category) {
		case PointOfInterestCategoryRestaurant:
			return @"Restaurant";
			break;
		case PointOfInterestCategoryParkingLot:
			return @"Parking Lot";
			break;
		case PointOfInterestCategoryBusStop:
			return @"Bus Stop";
			break;
		case PointOfInterestCategoryPub:
			return @"Pub";
			break;
		case PointOfInterestCategoryGym:
			return @"Gym";
			break;
		case PointOfInterestCategorySecurity:
			return @"Security";
			break;
		default:
			return @"Miscellaneous";
			break;
	}
}

+ (UIImage*)POICategoryImage:(NSString*)category {
	if ([category isEqualToString:@"Restaurant"]) {
		return [UIImage imageNamed:@"restaurant_pin.png"];
	} else if ([category isEqualToString:@"Parking Lot"]) {
		return [UIImage imageNamed:@"parking_pin.png"];
	} else if ([category isEqualToString:@"Bus Stop"]) {
		return [UIImage imageNamed:@"bus_pin.png"];
	} else if ([category isEqualToString:@"Pub"]) {
		return [UIImage imageNamed:@"pub_pin.png"];
	} else if ([category isEqualToString:@"Gym"]) {
		return [UIImage imageNamed:@"gym_pin.png"];
	} else if ([category isEqualToString:@"Security"]) {
		return [UIImage imageNamed:@"security_pin.png"];
	} else {
		return nil;
	}
}

@end
